﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using TireService.Data;
using System.Data;

namespace TireService.Website.Reports.Data
{
    public class ReportData
    {
        private TireServiceDB db = new TireServiceDB();

        ///// <summary>
        ///// Return datatable with all invoicedetail records for a specific invoice
        ///// </summary>
        ///// <param name="InvoiceId">Id on invoice</param>
        ///// <returns>Datatable with invoicedetail information</returns>
        //public DataTable GetInvoiceDetails(int InvoiceId)
        //{
        //    // Get all invoicedetail records for a specific invoice

        //    List<InvoiceDetail> invoicedetails = this.db.GetInvoiceDetails(InvoiceId);

        //    // Create datatable
        //    DataTable dtDataTable = new DataTable();

        //    #region Create columns in datatable

        //    DataColumn dcDataColumn;

        //    dcDataColumn = new DataColumn();
        //    dcDataColumn.DataType = Type.GetType("System.String");
        //    dcDataColumn.ColumnName = "Description";
        //    dtDataTable.Columns.Add(dcDataColumn);

        //    dcDataColumn = new DataColumn();
        //    dcDataColumn.DataType = Type.GetType("System.String");
        //    dcDataColumn.ColumnName = "Price";
        //    dtDataTable.Columns.Add(dcDataColumn);

        //    dcDataColumn = new DataColumn();
        //    dcDataColumn.DataType = Type.GetType("System.String");
        //    dcDataColumn.ColumnName = "VatPrice";
        //    dtDataTable.Columns.Add(dcDataColumn);

        //    dcDataColumn = new DataColumn();
        //    dcDataColumn.DataType = Type.GetType("System.String");
        //    dcDataColumn.ColumnName = "PriceIncludingVat";
        //    dtDataTable.Columns.Add(dcDataColumn);

        //    #endregion

        //    #region Insert rows into datatable

        //    foreach (InvoiceDetail invoicedetail in invoicedetails)
        //    {
        //        DataRow row;

        //        row = dtDataTable.NewRow();

        //        row["Description"] = invoicedetail.Description;
        //        row["PriceIncludingVat"] = string.Format("{0:N}", invoicedetail.Price);
        //        row["Price"] = string.Format("{0:N}", (invoicedetail.Price * Convert.ToDecimal("0,8")));
        //        row["VatPrice"] = string.Format("{0:N}", (invoicedetail.Price * Convert.ToDecimal("0,2")));

        //        dtDataTable.Rows.Add(row);
        //    }

        //    #endregion

        //    return dtDataTable;
        //}

    }
}